﻿<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="/">
		<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
				<title>
					<xsl:value-of select="xbel/title" />
				</title>
				<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
			</head>

			<body>
				<div class="xbel">
					<div class="title">
						<xsl:value-of select="xbel/title" />
					</div>
					<div class="content">
						<xsl:for-each select="xbel/folder | xbel/bookmark">
							<xsl:choose>
								<xsl:when test="local-name(.)='folder'">
									<xsl:call-template name="displayFolder" />
								</xsl:when>
								<xsl:when test="local-name(.)='bookmark'">
									<xsl:call-template name="displayBookmark" />
								</xsl:when>
							</xsl:choose>
						</xsl:for-each>
					</div>
					<p class="footer">Generated from an XBEL compliant file through xbel2html.xsl</p>
				</div>
			</body>
		</html>
	</xsl:template>

	<xsl:template name="displayFolder" match="folder">
		<div class="folder">
			<div class="title">
				<xsl:element name="img">
					<xsl:attribute name="src"><![CDATA[
OWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanZZ3VFTXFofPvXd6oc0wAlKG3rvAANJ7k15F
YZgZYCgDDjM0sSGiAhFFRJoiSFDEgNFQJFZEsRAUVLAHJAgoMRhFVCxvRtaLrqy89/Ly++Osb+2z
97n77L3PWhcAkqcvl5cGSwGQyhPwgzyc6RGRUXTsAIABHmCAKQBMVka6X7B7CBDJy82FniFyAl8E
AfB6WLwCcNPQM4BOB/+fpFnpfIHomAARm7M5GSwRF4g4JUuQLrbPipgalyxmGCVmvihBEcuJOWGR
DT77LLKjmNmpPLaIxTmns1PZYu4V8bZMIUfEiK+ICzO5nCwR3xKxRoowlSviN+LYVA4zAwAUSWwX
cFiJIjYRMYkfEuQi4uUA4EgJX3HcVyzgZAvEl3JJS8/hcxMSBXQdli7d1NqaQffkZKVwBALDACYr
mcln013SUtOZvBwAFu/8WTLi2tJFRbY0tba0NDQzMv2qUP91829K3NtFehn4uWcQrf+L7a/80hoA
YMyJarPziy2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lH8Ov7/8Y/vyA
mPl5x6r/MNcDBBALzKTfIAwU/gM1e8fEpxg2y7E/ZXj0Uxqo8DsDIyOjL9AbmwECCGxAUOo9DMXo
3uL4/IBBf3UgQ7zxA4ZdmxHqAAKIBZtiEIg7/YPh+af/DO+//mP4AsQ5L3sZrA3kGbg3zgTKSsDV
AQQQEywMDIFhwANkvwQqPvbyD0ISCHj+f2QIEtrMwO0ixZDIvxQUjHADAAKIBVdI271ZzKD5YgsD
M+tvBjYWZgZxWxmg6E8GS1sGhmOCKxg+XmRt3ZPAngUQQGADfAUhISfDwcjgKMgMZIEwK8Ofn2cZ
mO2kGJjYofZ8+cYgbMEFxB8Z/rwy1D3Re0EBIIBwuoBBI56BUVCf4cNaNwYBWyGgIcxwqc+3/jDs
mX/3UdCqf/IAAQQ34ODBg1jNERWKZGC9sICBV4kXLvb67CeGvpMMU4OAbIAAYgGmKilm9oXPcDlk
TsptBnV7YCK68ZXh44c/DMLyzAw8rH8Z5HkYxEDyAAHEAkwMz4GJwg+XAV9fcyz9eOM37+nb354d
fMBwwk2BwUNZiolLk++/OkgeIIDAmQIfPpHK8KrJhWERsliPFcOCGXYMZ4HJixMggBjJyc5AFwuD
whKUBgECDAA2gecf0tdVqgAAAABJRU5ErkJggg==
					]]>
					</xsl:attribute>			
				</xsl:element>
				<xsl:element name="a">
					<xsl:attribute name="href">#</xsl:attribute>
					<xsl:attribute name="onclick">javascript:_toggle(_gel('content_<xsl:value-of select="generate-id(.)" />'));</xsl:attribute>
					<xsl:value-of select="./title" />
				</xsl:element>
			</div>
			<div class="content" style="display: none;">
				<xsl:attribute name="id">content_<xsl:value-of select="generate-id(.)" /></xsl:attribute>
				<xsl:for-each select="./folder" >
					<xsl:call-template name="displayFolder" />
				</xsl:for-each>
				<xsl:for-each select="./bookmark" >
					<xsl:call-template name="displayBookmark" />
				</xsl:for-each>
			</div>
		</div>
	</xsl:template>

	<xsl:template name="displayBookmark" match="bookmark">
		<div class="bookmark">
			<xsl:choose>
				<xsl:when test="./info/metadata/@Icon!=''">
					<xsl:element name="img">
						<xsl:attribute name="src">
							<xsl:value-of select="./info/metadata/@Icon" />
							</xsl:attribute>			
					</xsl:element>
				</xsl:when>
				<xsl:otherwise>
					<xsl:element name="img">
						<xsl:attribute name="src"><![CDATA[
eJyVkttLUwEcxz/n7OLm5tzcxHlhXjLDsUg0xYweeurF8M1kkaiJL0Jv9T9UFERGEA578EENzMqX
CkGwgU8qgRuIYtOpXZyXM912djmnl4wSJ/h9/H0v/H5ffnAKWusM3rY6g/c0zWkQpl52zU298M4B
wpndNXZto7wxrcgro0qNncZsOjEb0dN+rVdfckHQF5cJPa3VvWddwB7yv4qo8oqq7nxSQ+PtEcB+
klB746K5rbyiqiRHr7PY7TZrnslkrakodLs8lwuQ1uAwjKvSUfDhfv740mo8ED1U9yJRYU9OCVJo
N70p3LrieOjzPX1gqr0DxIA4ZCTYXYPYOkSXYX8BYosgSSCJIJg43Etx9/XWI81iODb1dnxyvcF1
eLXMfT6X6C/YD0F8E6QAbM9AZBb2IhAVQGtldikdaR0I35tezjzWAGwfKPOjb/x+ZzpQf8njdAry
NkT88PMzRAOQSEDKiKIrZehLasE78K1zU1LfAWiOykjC+vuZ1cnavO/XPVXbxYQ/QuIHyBmQDWBy
MTqfN9/5fPFmUmHxb4nHSt0oygmLbHyFWALSGkgZIGmETIqiXEUENv41/PcHZTY8Dc4DNzsZSFnA
2gC2esiY4CBBQ1HSXWbDkzWgqVLXYtEadIiFbMkupetJaKjz2crQllioYDZg0cd1TZW5LVm/Z9Cb
P6YOn1NH+kuC5Q6x42he7hA7RvpLg+pwtTp42zqWzW+Z6LMEu5uNPsB1Au/qbjb6Jvryg4DlpABz
npaW42cdg/hHYz4a/Ablkdwn65WLsgAAAABJRU5ErkJggg==
						]]>
						</xsl:attribute>			
					</xsl:element>
				</xsl:otherwise>
			</xsl:choose>
			<xsl:element name="a">
				<xsl:attribute name="href">
					<xsl:value-of select="./@href" />
				</xsl:attribute>
				<xsl:attribute name="title">
					<xsl:value-of select="./@href" />
				</xsl:attribute>
				<xsl:attribute name="target">_blank</xsl:attribute>
				<xsl:value-of select="./title" />
			</xsl:element>
			<xsl:choose>
				<xsl:when test="./desc">
					<xsl:element name="div">
						<xsl:attribute name="class">description</xsl:attribute>
						<xsl:value-of select="./desc" />
					</xsl:element>
				</xsl:when>
			</xsl:choose>
		</div>
	</xsl:template>

</xsl:stylesheet>
